package marchsoft.modules.tiku.controller;

import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import marchsoft.response.Result;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;

import marchsoft.modules.tiku.service.IEPracticeRecordService;
import marchsoft.modules.tiku.entity.EPracticeRecord;

import java.util.List;


/**
* <p>
* 题库练习记录 前端控制器
* </p>
* @author zsy
* @since 2022-03-29
*/
@RequiredArgsConstructor
@RestController
@Slf4j
@Api(tags = "题库练习记录模块")
@RequestMapping("/api/ePracticeRecord")
public class EPracticeRecordController {
    private final IEPracticeRecordService ePracticeRecordService;

    /**
     * 传练习记录id
     * */
    @ApiOperation(value = "根据练习记录模块")
    @GetMapping(value = "/getEPracticeRecordById")
    public Result<List<EPracticeRecord>> getEPraticeRecord(Long id){
        return Result.success(ePracticeRecordService.getEPracticeRecordByIdForReids(id));

    }
    @ApiOperation(value = "添加练习记录")
    @PostMapping
    public Result<Void> insertEPracticeRecord(@RequestBody EPracticeRecord ePracticeRecord){
        ePracticeRecordService.addPracticeRecord(ePracticeRecord);
        return Result.success();
    }
}
